package com.promis.widget.mediapicker.entity;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Created by jidanbo on 2018/3/26.
 */

public class VideoParcelable extends MediaParcelable implements Parcelable {

    public long duration;

    public String compressPath;

    public String httpOriginalPath;

    public String httpThumbnailPath;

    public int httpThumbnailWidth;

    public int httpThumbnailHeight;

    public VideoParcelable(String path, String name, long time, long size, int id, String parentDir, long duration) {
        super(path, name, time, size, id, parentDir);
        this.duration = duration;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        super.writeToParcel(dest, flags);
        dest.writeLong(this.duration);
        dest.writeString(this.compressPath);
        dest.writeString(this.httpOriginalPath);
//        dest.writeParcelable(this.localThumbnailBitmap, flags);
        dest.writeString(this.httpThumbnailPath);
        dest.writeInt(this.httpThumbnailWidth);
        dest.writeInt(this.httpThumbnailHeight);
    }

    protected VideoParcelable(Parcel in) {
        super(in);
        this.duration = in.readLong();
        this.compressPath = in.readString();
        this.httpOriginalPath = in.readString();
//        this.localThumbnailBitmap = in.readParcelable(Bitmap.class.getClassLoader());
        this.httpThumbnailPath = in.readString();
        this.httpThumbnailWidth = in.readInt();
        this.httpThumbnailHeight = in.readInt();
    }

    public static final Creator<VideoParcelable> CREATOR = new Creator<VideoParcelable>() {
        @Override
        public VideoParcelable createFromParcel(Parcel source) {
            return new VideoParcelable(source);
        }

        @Override
        public VideoParcelable[] newArray(int size) {
            return new VideoParcelable[size];
        }
    };
}
